from django import template
import markdown
from django.utils.safestring import mark_safe

register = template.Library()

@register.filter
def render_markdown(value):
    return mark_safe(markdown.markdown(
        value,
        extensions=[
            'markdown.extensions.extra',
            'markdown.extensions.codehilite',
            'markdown.extensions.toc'
        ]
    ))